<?php
    foreach ($getDetail as $row1) {
        $vnik 		= 	$row1['USRUPD'];
		$vname 		= 	$row1['NAME'];
		$vorg 		= 	$row1['ORG'];
		$vjob		= 	$row1['JOB_POSITION'];
		$viscard	=	$row1['ISCARD'];
		$vistelp	=	$row1['ISTELP'];
		$vusefor	=	$row1['USE_FOR'];
		$vvendor	=	$row1['VENDOR'];
		$vusername	=	$row1['USER_NAME'];
		$vdtmupd	=	$row1['DTMUPD'];
		$vdesc		=	$row1['CTRL_DESCRIPTION'];
		$vdate1		=	$row1['CTRL_DATE_AWAL'];
		$vdate2		=	$row1['CTRL_DATE_AKHIR'];
		$vtime1		=	$row1['CTRL_HOUR_AWAL'];
		$vtime2		=	$row1['CTRL_HOUR_AKHIR'];
        $vphonefisik		=	$row1['CTRL_TELP_FISIK'];
		$vcardfisik		=	$row1['CTRL_CARD_FISIK'];
    }
    
    $str_acc_ctrl = '';
    foreach ($getFloor as $row2) {
        $str_acc_ctrl .= $row2['CARD_FLOOR_NAME'].', ';
    }
    $str_acc_ctrl = substr($str_acc_ctrl,0,-2);
    
    $str_line_telp = '';
    foreach ($getFloor2 as $row3) {
        $str_line_telp .= $row3['TELP_EXT_EXT_TYPE'].', ';
    }
    $str_line_telp = substr($str_line_telp,0,-2);
?>

<script>
    function cancel() {
        $.post("<?= site_url() ?>search_global", function(data) {
            window.location = '<?php echo base_url(); ?>search_global';
        });
    }
    function appManagerSave() {
        $.post("<?= site_url() ?>search_global/approve_managerSave", {
            pCtrlID: $('#pCtrlID').val(),
            pApproval: $('#pApproval').val(),
            pComment: $('#pComment').val(),
            pAccesNo: $('#pAccesNo').val(),
            pNikRequestBy: $('#pNikRequestBy').val()
        },
        function(data) {
            window.location = '<?php echo base_url(); ?>search_global';
        });
    }
</script>


<form id="formarea" role="form" method="post" action="#">
    <input type="hidden" value="<?php echo $cRequestNo; ?>" id="pCtrlID" />
    <input type="hidden" value="<?php echo $cTab; ?>" id="pCTab" />
    <input type="hidden" value="<?php echo $cType; ?>" id="pCType" />
    <input type="hidden" value="<?php echo $vnik;?>" id="pNikRequestBy" name="pNikRequestBy"/>
<div class="col-md-offset-0" id="top">
    <div class="col-md-11">
        <div class="panel panel-default">
			<div class="panel-heading">
			<h4 class="panel-title"><b> Requestor </b></h4>
			</div>
			<div class="panel-body">
            <input type="hidden" value="<?php echo $cRequestNo; ?>" id="pCtrlID" />
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-2">Access Control</label>
    						<div class="col-md-10"><?php echo $str_acc_ctrl;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-2">Line Telp</label>
    						<div class="col-md-10"><?php echo $$vistelp==1?'Yes':'No'; ?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-2">Fasilitas Line Telp</label>
    						<div class="col-md-10"><?php echo $str_line_telp; ?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-2">ID Card</label>
    						<div class="col-md-10"><?php echo $vcardfisik=='1'?'Yes':'No'; ?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-2">Fixed Phone</label>
    						<div class="col-md-10"><?php echo $vphonefisik; ?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-2">Name</label>
    						<div class="col-md-10"><?php echo $vvendor; ?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-2">Person</label>
    						<div class="col-md-10"><?php echo $vusername; ?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-2">Periode</label>
    						<div class="col-md-10"><?php echo "$vdate1 &nbsp;s/d&nbsp; $vdate2" ; ?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-2">Tgl Request Order</label>
    						<div class="col-md-10"><?php echo $vdtmupd; ?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-2">Description</label>
    						<div class="col-md-4">
                                <textarea class="form-control input-sm" name="pComment"><?php echo $vdesc; ?></textarea>
    						</div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-2">Comment</label>
    						<div class="col-md-4">
                                <textarea class="form-control input-sm" id="pComment"></textarea>
    						</div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-2">Approval</label>
    						<div class="col-md-4">
                                <select class="form-control input-form select2" id="pApproval" style="width:100%">
                        			<option value="Y">Approve</option>
                                    <option value="N" selected="">Disapprove</option>
				                </select>
    						</div>
				        </div>
                    </div>                   
                </div>
                
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-2"></label>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-2"></label>
    						<div class="col-sm-2">
                                <button type="button" class="btn btn-primary btn-block" onclick="appManagerSave();">Submit</button>
                            </div>
                            <div class="col-sm-2">
                                <button type="button" class="btn btn-default btn-block" onclick="cancel();" >Cancel</button>
                            </div>
				        </div>
                    </div>                   
                </div>
                
            </div>
        </div>
    
    </div>
</div>
</form>